<script>
  var minimumOperations = function (nums) {
    nums = nums.filter(Boolean);
    nums.sort((a, b) => a - b);
    let ans = 0;
    console.log()
    while (nums.length > 0) {
      ans++;
      const n = nums[0];
      for (let i = 0; i < nums.length; i++) {
        nums[i] -= n;
      }
      nums = nums.filter(Boolean);
    }
    return ans;
  };
  console.log(minimumOperations([1]));
</script>